package day15;

import com.alibaba.fastjson.JSON;
import day4.BankAcc;

import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class ToJson2 {
    public static void main(String[] args) {
        List<BankAcc> list = new ArrayList<>();
        list.add(new BankAcc("hf--1", "老吴", "123", "shanghai", 1000000.0F));
        list.add(new BankAcc("hf--2", "小刘", "1243", "shanghai", 100030.0F));
        list.add(new BankAcc("hf--3", "小李", "1523", "nanjing", 60000.0F));
        list.add(new BankAcc("hf--4", "老张", "623", "shanghai", 1000.0F));
        list.add(new BankAcc("hf--3", "小马", "282938282", "安庆", 7676666.0F));
        String str = JSON.toJSONString(list);
        System.out.println(str);
        try {
            FileWriter fw=new FileWriter("bank.json");
            fw.write(str);
            fw.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
